<%@ page import="com.hotel.entity.Subscription" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.text.SimpleDateFormat" %>
<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/hotel/style/style.css"></link>
  <style type="text/css">
    body {
      margin: 0;
      padding: 0;
      font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
      background: linear-gradient(to right, #e0f7fa, #80deea);
    }

    #container {
      max-width: 900px;
      margin: 0 auto;
      padding: 20px;
    }

    #content {
      padding: 20px 0;
      display: flex;
      justify-content: center;
    }

    table {
      width: 100%;
      max-width: 800px;
      border-collapse: collapse;
      background-color: #ffffff;
      box-shadow: 0 4px 8px rgba(0,0,0,0.1);
      border-radius: 8px;
      overflow: hidden;
      font-size: 0.95em;
    }

    caption {
      padding: 20px 0;
      font-size: 1.5em;
      font-weight: bold;
      text-align: center;
      color: #006064;
    }

    th, td {
      border: 1px solid #b0bec5;
      padding: 12px 15px;
      text-align: center;
      vertical-align: middle;
    }

    th {
      background-color: #00838f;
      color: white;
      font-weight: bold;
    }

    td {
      color: #333;
    }

    .type {
      width: 150px;
    }

    .price {
      width: 120px;
    }

    .introduce {
      text-align: left;
      padding-left: 15px;
    }

    #content div.button {
      text-align: center;
      padding-top: 15px;
    }

    hr {
      margin-top: 40px;
      border: none;
      border-top: 1px solid #ccc;
    }

    #footer {
      text-align: center;
      padding: 20px;
      font-size: 0.9em;
      color: #666;
    }



  input[type="button"] {
      background-color: #00796b;
      color: white;
      font-weight: 600;
      padding: 10px 25px;
      border: none;
      border-radius: 25px;
      cursor: pointer;
      font-size: 1.1em;
      transition: background-color 0.3s ease;
    }

input[type="button"]:hover {
      background-color: #004d40;
    }

  </style>

  <title>会员中心</title>
</head>
<body>
<%
  List<Subscription> subscriptions = (List<Subscription>) request.getAttribute("cgs");
  SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
%>
<div id="container">
  <div id="header">
    <ul>
      <li><a href="#">帮助</a></li>
    </ul>
  </div>
  <div id="menu">
    <ul>
      <li><a href="<%=request.getContextPath()%>/hotel/index.jsp">首页</a></li>
      <li><a href="<%=request.getContextPath()%>/list.book">图书列表</a></li>
      <li><a href="<%=request.getContextPath()%>/list.subscription">会员中心</a></li>
    </ul>
  </div>
  <div id="content">
    <div class="submenu">
      <ul>
        <li><a href="<%=request.getContextPath()%>/list.subscription">图书预订</a></li>
        <li><a href="<%=request.getContextPath()%>/list.hsubscription">历史订单</a></li>
        <li><a href="<%=request.getContextPath()%>/editMember.member">修改信息</a></li>
        <li><a href="<%=request.getContextPath()%>/hotel/editPassword.jsp">修改密码</a></li>
        <li><a href="<%=request.getContextPath()%>/hotel/index.jsp">退出系统</a></li>
      </ul>
    </div>
    <div class="subcontent">
      <p>下面是尚未确认的预定信息，您可以增加、修改或删除订单信息。</p>
      <table>
        <thead>
        <tr>
          <th>创建时间</th>
          <th>订单号</th>
          <th>联系人</th>
          <th>联系电话</th>
          <th>电子邮件</th>
          <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <%
          if (subscriptions == null || subscriptions.isEmpty()) {
        %>
        <tr>
          <td colspan="6" style="text-align:center; color:#999;">没有订单</td>
        </tr>
        <%
        } else {
          for (Subscription c : subscriptions) {
        %>
        <tr>
          <td><%= c.getCretime() != null ? sdf.format(c.getCretime()) : "无" %></td>
          <td><%= c.getNo() %></td>
          <td><%= c.getLinkman() %></td>
          <td><%= c.getPhone() %></td>
          <td><%= c.getEmail() %></td>
          <td>
            <div>
              <a href="#" onclick="return confirm('真的要删除该订单及其明细信息吗？') ? location.href='<%=request.getContextPath()%>/deleteSubscription.member?no=<%= c.getNo() %>' : false;">删除</a>
              <a href="<%=request.getContextPath()%>/hotel/editSubscription.jsp?no=<%= c.getNo() %>&linkman=<%= c.getLinkman() %>&phone=<%= c.getPhone() %>&email=<%= c.getEmail() %>">联系人信息</a>
              <a href="<%=request.getContextPath()%>/getBookidDetails.member?no=<%= c.getNo() %>">预定信息</a>
            </div>
          </td>
        </tr>
        <%
            }
          }
        %>
        </tbody>
      </table>
      <div class="button">
        <input type="button" value="新建订单" onclick="location='<%=request.getContextPath()%>/hotel/newSubscription.jsp'" />
      </div>
    </div>
  </div>
  <hr />
  <div id="footer">
  </div>
</div>
</body>
</html>
